﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DCTEDU_/CanBoMaster.master" AutoEventWireup="true"
    CodeBehind="XemTinhTrang.aspx.cs" Inherits="QuanLyThietBi.DCTEDU_.BaoCao.XemTinhTrang" %>

<%@ Register Assembly="PagerControl" Namespace="CutePager" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Xem tất cả báo cáo</title>       
    <script type="text/javascript">
        function PrintDiv() {
            var contents = document.getElementById("getPrint").innerHTML;
            var frame1 = document.createElement('iframe');
            frame1.name = "frame1";
            frame1.style.border = "1";
            frame1.style.width = "1px";
            frame1.style.position = "absolute";
            frame1.style.top = "-1000000px";
            document.body.appendChild(frame1);
            var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
            frameDoc.document.open();
            frameDoc.document.write('<html><head><title>Báo cáo Tình trạng trang thiết bị</title>');
            frameDoc.document.write('</head><body>');
            frameDoc.document.write(contents);
            frameDoc.document.write('</body></html>');
            frameDoc.document.close();
            setTimeout(function () {
                window.frames["frame1"].focus();
                window.frames["frame1"].print();
                document.body.removeChild(frame1);
            }, 500);
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">        
<asp:UpdatePanel runat="server" ID="uppanel1">
    <ContentTemplate>
    <asp:HiddenField runat="server" ID="H_PhongHocId" Value="0" />
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">  
            <header class="panel-heading">
                    Báo cáo tình trạng hoạt động 
                    <span class="tools pull-right">    
                    <asp:CheckBox runat="server" ID="chkTrangThai" AutoPostBack="True" OnCheckedChanged="chkTrangThai_OnCheckedChanged" CssClass="form-group changed" style="margin-right: 10px;" Text="Đang chờ sửa chữa?"/>
<asp:DropDownList runat="server" ID="cboPhongHoc" AutoPostBack="True" OnSelectedIndexChanged="cboPhongHoc_OnSelectedIndexChanged" CssClass="form-group"/> 
                    </span>
           </header>  
           <div class="panel-body">  
             <div class="row">  
             <div class="col-lg-12">
                  <section class="panel">  

            <div class="panel-body" id="getPrint">
                 <table class="table table-striped">
                                <thead>
                                <tr>   
                                 <th>#</th>
                                    <th>Tên thiết bị</th>   
                                    <%= H_PhongHocId.Value == "0" ? "<th>Phòng học</th>" : ""%>
                                    <th>Ghi chú</th>  
                                    <th>Hướng giải quyết</th>   
                                    <th>Loại tình trạng</th>
                                    
                                    <th>Ngày báo cáo</th>  
                                    <th>Ngày sửa chữa</th>
                                    <th>Tình trạng</th>
                                </tr>
                                </thead>
                                <tbody>
                                <asp:Repeater runat="server" ID="rpHoatDong"><ItemTemplate>
                                  <tr>
                                      <td><%# Container.ItemIndex + 1%> </td>
                                      <td><%# getTenThietBi(Eval("MaThietBi")) %></td>  
                                      <%# H_PhongHocId.Value == "0" ? "<td>"+ getTenPhong(Eval("MaThietBi")) +"</td>" : ""%> 
                                      <td><%# Eval("GhiChu") %></td> 
                                       <td><%# getHuongGiaiQuyen(Eval("MaHoatDongSuaChua")) %></td> 
                                      <td><%# getLoaiTinhTrang(Eval("MaLoaiTinhTrang"))%></td>
                                       
                                      <td><%# Convert.ToDateTime(Eval("NgayCapNhat")).ToString("dd/MM/yyyy") %></td>  
                                       <td><%# getNgaySuaChua(Eval("MaHoatDongSuaChua"))%></td>
                                      <td><%# getTinhTrang(Eval("MaThietBi"))%></td>
                                  </tr>
                                </ItemTemplate></asp:Repeater> 
                                 <cc1:Pager ID="Pager1" runat="server" PreviousClause="Lùi" NextClause="Tiến" LastClause=""
                                    FirstClause="" PageClause="Trang " OfClause=" /" PageSize="10" OnCommand="Pager1_Command"
                                    ForeColor="#006600" Font-Bold="True" />
                                </tbody>
                        </table> 
                       
                </div>        
                 <asp:Button ID="cmdPrint" runat="server" CausesValidation="false" OnClick="cmdPrint_OnClick" Text="In báo cáo" CssClass="btn btn-primary btn-image-print" />
                </section>   

                 </div>
                 </div>
           </div>
           </section>
        </div>
    </div>    
    </ContentTemplate>  
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="cboPhongHoc" EventName="SelectedIndexChanged"/>
    </Triggers>
</asp:UpdatePanel> 
<asp:UpdateProgress runat="server" ID="UpdateProgress2" AssociatedUpdatePanelID="uppanel1">
        <ProgressTemplate>
            <div style="top: 20%; right: 50%; transition: all 300ms ease 100ms; color: Black;
                padding: 8px; position: fixed; z-index: 10000">
                <asp:Image runat="server" ID="imgloading" ImageUrl="~/Images/loading.gif" /></div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
